<?php
session_start();
require_once("include/authen.php");
require_once("include/ui.php");

if ($_SESSION["permission"][$serviceScreen]["View"]=="0"){
	echo "<script>alert('".$no_permit."');</script>";
	echo "<meta http-equiv = refresh ; content = '0 ; url = mainscreen.php'>";
	exit();
}
// show header
echo headerPage("Product Maintenance");
?>
<SCRIPT src="js/js_service.js"></SCRIPT>
<script>
$(function() {
	$("#Price").keypress(function(e){
		
		if(e.which!=46 && e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){
			return false;
		}
	});
	$("#Scale, #Amount,#Times,#LimitNumber").keypress(function(e){
		
		if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){
			return false;
		}
	});
		$( "#txtDateTo" ).datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
		$("#btnPrint").live('click',function(){
		$("#normal-screen").hide();
		$("#page-header").hide();
		$("#searchdata").hide();
		$(".toolbar-box").hide();
		$("#foolter_table").hide();
		$("#leftboder").hide();
		$("#rightboder").hide();
		
		window.print();
		
		$("#normal-screen").show();
		$("#page-header").show();
		$("#searchdata").show();
		$(".toolbar-box").show();
		$("#foolter_table").show();
		$("#leftboder").show();
		$("#rightboder").show();
	});	
});
</script>
<FORM name="Act" action="<?php echo $PHP_SELF?>" method="post"><INPUT
	type=hidden value="add" id="mode" name="mode"> <INPUT type=hidden
	value="Admin" id="user" name="user">

<table width="1024" border="0" align="center" cellpadding="0"
	cellspacing="0">
	<tr>
		<td width="10" id='leftboder' style="border-left: 2px solid #facb0c;">&nbsp;</td>
		<td width="1004" valign="top">
		<div class="content-box">
		<div Class="toolbar-box">
		<div class="t">
		<div class="t">
		<div class="t"></div>
		</div>
		</div>
		<div class="m">
		<div class="toolbar">
		<table class="toolbar">
			<tr>
				<td><?php  if ($_SESSION["permission"][$serviceScreen]["Add"]=="1") {?>
				<a href="javascript:void('0');" id="btnAdd"> <span class="icon_add"></span>Add
				</a> <?php }?></td>
				<td><a href="javascript:void('0');" title="Print" id="btnPrint"> <span
					class="icon_Print"></span>Print </a></td>
			</tr>
		</table>
		</div>
		<div class="header" style="background-image: url(images/package.png);">
		Service Commission</div>
		<div class="clr"></div>
		</div>
		<div class="b">
		<div class="b">
		<div class="b"></div>
		</div>
		</div>
		</div>
		<div id="element-box">
		<div class="t">
		<div class="t">
		<div class="t"></div>
		</div>
		</div>
		<div class="m">
		<table width="100%" id='searchdata'>
			<tr>
				<td width="15%" class="fontSearch" style="padding-left: 20">Service
				Name :</td>
				<td width="85%" align=left><input id="txtServiceName_s"
					title="Filter by Service name " type="text" size=40
					name="txtServiceName_s" class="boxItem" /></td>
			</tr>

			<tr>
				<td width="15%" class="fontSearch" style="padding-left: 20">Employee
				Name :</td>
				<td width="85%" align=left><input id="txtEmployee_s"
					title="Filter by Employee name " type="text" size=40
					name="txtEmployee_s" class="boxItem" /></td>
			</tr>

			<tr>
				<td />
				<td><a href="javascript:void('0');" id="btnSearch"><img
					src="./images/btn-search.gif" border=0 /></a></td>
			</tr>
			<tr>
				<td colspan="2">
			
			</tr>
		</table>
		<table cellspacing="1" id="resultData" class=list>
			<thead>
				<tr>
					<th width="5%">No</th>
					<th style='display: none'>ID</th>
					<th class="title" width="37%">Service</th>
					<th class="title" width="25%" nowrap="nowrap">Employee</th>
					<th class="title" width="18%" nowrap="nowrap">Position</th>
					<th class="title" width="10%" nowrap="nowrap">Commission</th>
					<th class="title" width="5%" nowrap="nowrap">Edit</th>
					<th class="title" width="5%" nowrap="nowrap">Del</th>
				</tr>
			</thead>
			<tbody>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="7">
					<div class="boxfooter">
						<div id="paging_btn"></div>
						<div class="totalpage">Total : <span id="rowCount">0</span>&nbsp;&nbsp;rows</div>
					</div>			
					</td>
					
				</tr>
			</tfoot>
		</table>
		<div class="clr"></div>
		</div>
		<div class="b">
		<div class="b">
		<div class="b"></div>
		</div>
		</div>
		<div class="clr"></div>
		</div>
		<!-- elementbox--></div>
		</td>
		<td width="10" id='rightboder'
			style="border-right: 2px solid #facb0c;">&nbsp;</td>

	</tr>
</table>
</FORM>

<div id="dialog-confirm" title="Confirm delete?"
	style="padding-top: 20px;">
<p style="font-size: 13px"><span class="ui-icon ui-icon-alert"
	style="float: left; margin: 0 7px 20px 0;"> </span>Are you sure this
service commission?</p>
</div>
<div id="dialog-form">
<p class="validateTips">* fields are required.</p>
<form>
<table cellpadding="3" cellspacing="0" border="0" width="100%"
	class="fieldset">
	<tr>
		<td width="30%"><label for="name">Prdocut Type : *</label></td>
		<td width="70%"><select id="ProductType"  style="width: 20em; font-size: 12px"
			class="ui-widget ui-widget-content ui-corner-left" /></td>
	</tr>
 
		<tr>
			<td width="30%"><label for="name">Product Name : *</label></td>
			<td width="70%"><input type="text" name="ProductName"
				id="ProductName" class="text ui-widget-content ui-corner-all" /></td>
		</tr>

			<tr>
				<td width="30%"><label for="name">Category : *</label></td>
				<td width="70%"><select name="Category"
					style="width: 20em; font-size: 12px;"
					class="ui-widget ui-widget-content ui-corner-left" id="Category" />
				</td>
			</tr>
	 
				<tr>
					<td width="30%"><label for="name">Main Unit :</label></td>
					<td width="70%"><select name="MainUnit"
						style="width: 6em; font-size: 12px;" id="MainUnit"
						class="ui-widget ui-widget-content ui-corner-left" /></td>
				</tr>
		 
					<tr class="subUnit_hide">
						<td width="30%"><label for="name">Sub Unit :</label></td>
						<td width="70%"><select name="SubUnit" id="SubUnit"
							class="ui-widget ui-widget-content ui-corner-left"
							style="width: 6em; font-size: 12px;"></select> &nbsp;<label
							for="name">Scale :</label>&nbsp; <input type="text" name="Scale"
							id="Scale" class="ui-widget-content ui-corner-all"
							style="width: 7em; padding: 3px; font-size: 12px;" /></td>
					</tr>
				 
						<tr class="product_cost">
							<td width="30%"><label for="name">Cost :</label></td>
							<td width="70%"><input type="text" name="Cost_Price"
								id="Cost_Price" class="text ui-widget-content ui-corner-all"
								disabled /></td>
						</tr>
						<tr class="cost_on_branch">
							<td width="30%"><label for="name">Cost Of Branch :</label></td>
							<td width="70%"><input type="text" name="Cost_branch"
								id="Cost_branch" class="text ui-widget-content ui-corner-all" />
							</td>
						</tr>
						<tr>
							<td width="30%"><label for="name">Price :</label></td>
							<td width="70%"><input type="text" name="Price" id="Price"
								class="text ui-widget-content ui-corner-all" /></td>
						</tr>
						<tr>
							<td width="30%"><label for="name">Commission :</label></td>
							<td width="70%"><input type="text" name="Commission"
								id="Commission" class="text ui-widget-content ui-corner-all"
								style="width: 5em; text-align: left;" /> <select
								name="CommissionType" id="CommissionType"
								class="ui-widget ui-widget-content ui-corner-left"
								style="width: 6em; font-size: 12px;">
								<option value="0">BAHT</option>
								<option value="1">%</option>
							</select></td>
						</tr>
						<tr class="pos_hide">
							<td><label for="status">Product in POS </label></td>
							<td><input type="checkbox" name="IsPOS" id="IsPOS" value=""
								checked /><label for="status">Yes</label></td>
						</tr>
						<tr class="stock_hide">
							<td><label for="status">Stock </label></td>
							<td><input type="checkbox" name="IsStock" id="IsStock" value=""
								checked /><label for="status">Yes</label></td>
						</tr>
						<tr class="premium_hide">
							<td><label for="status">Premium </label></td>
							<td><input type="checkbox" name="IsPremium" id="IsPremium"
								value="" /><label for="status">Yes</label></td>
						</tr>
						<tr class="LimitAmount">
							<td><label for="status">Minimum limit </label></td>
							<td><input type="text" name="LimitNumber" value="5"
								id="LimitNumber" class="text ui-widget-content ui-corner-all"
								style="width: 7em;" /></td>
						</tr>
						<tr class="Times_hide">
							<td width="30%"><label for="name">Times :</label></td>
							<td width="70%"><input type="text" name="Times" id="Times"
								class="text ui-widget-content ui-corner-all" /></td>
						</tr>
						<tr>
							<td colspan=2 valign="top" style="padding-top: 10px;">
							<fieldset class="ui-widget ui-widget-content"><legend><label
								id="lblGroup">Please select Product</label></legend>
							<div style="height: 10px">&nbsp;</div>
							<div class="ui-widget" style="font-size: 12px; height: 30px;"><label><span
								id="lblTitle">Product:</span>&nbsp;&nbsp; <select
								name="productlist" id="productlist" style="line-height: 30px;"></select>&nbsp;&nbsp;
							<span id="spanAmt">Amount: </span>&nbsp; <input type="text"
								name="Amount" style="width: 10%; padding: 5px; font-size: 12px;"
								maxlength=5 id="Amount" class="ui-widget-content ui-corner-all" />
							&nbsp;&nbsp;
							<button id="btnAddProduct" style="font-size: 12px">Add</button>
							</label></div>
							<table id="tbNewProduct" cellspacing="1" width="100%"
								cellpadding="3" border="0"
								style="background-color: #f9f9f9; font-size: 12px; border: 1px solid #EAEAEA;">
								<thead>
									<tr style="background-color: #CCC; font-weight: bold;">
										<th width="10%">#</th>
										<th width="65%">Name</th>
										<th width="15%">Amount</th>
										<th width="10%">Del</th>
									</tr>
								</thead>
								<tbody style="font-weight: normal; background-color: #fff">
								</tbody>
							</table>
							</fieldset>
							</td>
						</tr>

</table>
</form>
</div>
<?php echo footer();?>